import 'package:flutter_douban/model/Avatar.dart';
import 'package:flutter_douban/model/Cast.dart';
import 'package:flutter_douban/model/Rating.dart';
import 'package:json_annotation/json_annotation.dart';

part 'Subject.g.dart';

@JsonSerializable(nullable: false)
class Subject {
  final Rating rating;
  final String title;
  @JsonKey(name: "collect_count")
  final int collectCount;
  @JsonKey(name: "has_video")
  final bool hasVideo;
  @JsonKey(name: "original_title")
  final String originalTitle;
  final String subtype;
  final String year;
  final Avatar images;
  final String alt;
  final String id;
  final List<String> pubdates;
  final List<Cast> casts;
  final List<Cast> directors;
  final List<String> genres;

  Subject(
      this.rating,
      this.title,
      this.collectCount,
      this.hasVideo,
      this.originalTitle,
      this.subtype,
      this.year,
      this.images,
      this.alt,
      this.id,
      this.pubdates,
      this.casts,
      this.directors,
      this.genres);

  factory Subject.fromJson(Map<String, dynamic> json) =>
      _$SubjectFromJson(json);
  Map<String, dynamic> toJson() => _$SubjectToJson(this);
}
